package com.example.demo.mapper;

import com.example.demo.entity.CustomUser;
import org.apache.catalina.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    @Update("update  customuser set name=#{name},username=#{username},password=#{password},classes=#{classes},operator=#{operator},deptid=#{deptid},openid=#{openid},createtime=#{createtime} where id=#{id}")
    public void upgrade(User user);

    @Update("update  customuser set name=#{name},username=#{username},classes=#{classes} where id=#{id}")
    public void xgxm(CustomUser customUser);

    @Update("update  customuser set password=#{password} where id=#{id}")
    public void passw(CustomUser customUser);

    @Select("select * from customuser where username=#{username} and password=#{password}")
    public List<CustomUser> getUser(CustomUser customUser);

    @Insert("insert into customuser (name,username,password,classes,operator,deptid,openid,createtime)values(#{name},#{username},#{password},#{classes},#{operator},#{deptid},#{openid},#{createtime})")
    public void postuser(CustomUser customUser);

    @Select("select * from customuser where username=#{username}")
    public List<CustomUser> getpeople(CustomUser customUser);

    //根据学号获取人的数据
    @Select("select * from customuser where username=#{username}")
    public List<CustomUser> getp(int username);

    @Select("select * from customuser where openid=#{openid}")
    public List<CustomUser> openidMa(String openid);

    @Select("select * from customuser ")
    public List<CustomUser> alllist();

    @Delete("delete from  customuser where id=#{id} ")
    public void scstudent(String id);


}
